using Core;

namespace g_gongjianta
{
    public class AnchorEventHandler : EventHandler<Anchor>
    {
        protected override void AddEventListener()
        {
            messenger.AddListener<Bullet>("bullet_create", OnBulletCreateHandler);
        }

        protected override void RemoveEventListener()
        {
            messenger.RemoveListener<Bullet>("bullet_create", OnBulletCreateHandler);
        }

        private void OnBulletCreateHandler(Bullet bullet)
        {
            var bow = Unit.Bow;
            bullet.Pos = bow.Pos;
            bullet.transform.rotation = bow.transform.rotation;
        }
    }
}